﻿@{
    Layout = null;
}
@model System.Data.DataTable
<!DOCTYPE html>
<html>
@Html.Partial("LoadPanelPartial")
<head>
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    @Html.DevExpress().GetStyleSheets(
                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }

)
    <script type="text/javascript">

        var rootUrl = '@Url.Content("~/YGZAllowance/")';

        function Add() {
            showWindow(rootUrl + 'YGZAllowanceEdit');
        }

        function Import() {
            showWindow(rootUrl + 'YGZAllowanceImport');
        }

        function Edit(id) {
            showWindow(rootUrl + 'YGZAllowanceEdit/' + id);
        }

        function Del(id, index) {
            if (confirm("确定删除？")) {
                $.get(rootUrl + 'Delete/' + id, function (data) {
                    if (data) {
                        alert("删除成功！");
                        gvEditing.Refresh();
                    }
                    else { alert("删除失败！"); }
                });
            }

        }

        function showWindow(name) {
            $("#popContent").attr("src", name + "?x=" + Math.random());
            pop.Show();
        }

        function Cancel() {
            pop.Hide();
        }

        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnAdd":
                    {
                        Add();
                        break;
                    }
                case "btnImport":
                    {
                        Import();
                        break;
                    }
            }
        }
        
    </script>
</head>
<body>
    @Html.DevExpress().Menu(settings =>
{
    settings.Name = "toolBarMenu";
    settings.ItemAutoWidth = false;
    settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
    settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
    settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);
    settings.Items.Add(item =>
    {
        item.Name = "btnAdd";
        item.Text = "增加";
        item.Image.Url = Url.Content("~/Content/ControlImages/edit_add.png");
    }); 
    settings.Items.Add(item =>
    {
        item.Name = "btnImport";
        item.Text = "导入";
        item.Image.Url = Url.Content("~/Content/ControlImages/excel.png");
    });
    settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
    settings.ItemLinkMode = ItemLinkMode.ContentBounds;
}).GetHtml()



@Html.Partial("YGZAllowancePartial", Model)


 @Html.DevExpress().PopupControl(
    settings =>
    {
        settings.Name = "pop";
        settings.Width = 600;
        settings.Height = 300;
        settings.AllowDragging = true;
        settings.CloseAction = CloseAction.CloseButton;
        settings.EnableAnimation = false;
        settings.HeaderText = "营改增补助信息";
        settings.Modal = true;
        settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
        settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
        settings.ShowFooter = true;
        settings.SetFooterTemplateContent(s =>
        {
            ViewContext.Writer.Write("<table align='center'><tr><td>");
            @Html.DevExpress().Button(footBtnSettings =>
            {
                footBtnSettings.Name = "btnOK";
                footBtnSettings.Text = "确定";
                footBtnSettings.ClientSideEvents.Click = "function(s,e){popContent.OK()}";
                footBtnSettings.Images.Image.Url = Url.Content("~/Content/ControlImages/ok.png");
                footBtnSettings.CausesValidation = false;
            }).GetHtml();
            ViewContext.Writer.Write("</td><td>");
            @Html.DevExpress().Button(footBtnSettings =>
            {
                footBtnSettings.Name = "btnCancel";
                footBtnSettings.Text = "取消";
                footBtnSettings.ClientSideEvents.Click = "Cancel";
                footBtnSettings.Images.Image.Url = Url.Content("~/Content/ControlImages/no.png");
                footBtnSettings.CausesValidation = false;
            }).GetHtml();
            ViewContext.Writer.Write("</td></tr></table>");

        });
        settings.SetContent(() =>
       {
           ViewContext.Writer.Write("<iframe  id='popContent' name='popContent' style='width:100%;height:300px;' frameborder='0' ></iframe>");
       });
    }).GetHtml()
</body>
</html>
<script>
    lp.Hide();
</script>
